﻿Imports System.Text
Imports Microsoft.VisualStudio.TestTools.UnitTesting

Imports Logistica.Core
Imports Logistica.Entities


<TestClass()> Public Class AlmacenTest

    <TestMethod()> Public Sub ListarAlmacenTest()
        Dim listado As List(Of AlmacenBE) = Almacen.Listar

        Assert.IsNotNull(listado)
        Assert.IsTrue(listado.Count > 0)
    End Sub


    <TestMethod()>
    Public Sub RegistrarAlmacenTest()
        Dim infoAlmacen As New AlmacenBE With {.Codigo = "ALM099", .Nombre = "Almancen 99"}
        Dim idRegistro As Integer = Almacen.Registrar(infoAlmacen)

        Assert.IsTrue(idRegistro > 0)
    End Sub

    <TestMethod()>
    Public Sub ActualizarAlmacenTest()
        Dim infoAlmacen As New AlmacenBE With {.Id = 1, .Descripcion = "Descripcion 001"}
        Dim idRegistro As Integer = Almacen.Registrar(infoAlmacen)

        Dim almacenActualizado As AlmacenBE = Almacen.Obtener(infoAlmacen)

        Assert.AreEqual(idRegistro, almacenActualizado.Id)
    End Sub

    <TestMethod()>
    Public Sub EliminarAlmacenTest()
        Dim infoAlmacen As New AlmacenBE With {.Id = 10}
        Almacen.Eliminar(infoAlmacen)

        Dim almacenEliminado As AlmacenBE = Almacen.Obtener(infoAlmacen)

        Assert.IsTrue(almacenEliminado.IsEmpty)
    End Sub

End Class